package animation.model;


/**
 * Created by IntelliJ IDEA.
 * User: emilio
 * Date: Aug 17, 2004
 * Time: 10:58:57 PM
 * To change this template use File | Settings | File Templates.
 */
public class RandomDataModel
        implements SortDataModel
{
    public int[] fill(int length)
    {
        int[] array = new int[length];
        fillRandom(array, length);
        return array;
    }

    protected void fillRandom(int[] array, int lengthToFill)
    {
        java.util.Random random = new java.util.Random(1);
        final int length = array.length;
        for (int i = 0; i < lengthToFill; i++) {
            array[i] = random.nextInt(lengthToFill) * (length / lengthToFill) + 1;
        }
    }

    public String toString()
    {
        return "Random";
    }
}
